package com.PAT.practice02;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/01/27/14:10
 * @Description:
 * @Target: 20分
 */
public class 性感素数 {


    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Integer ss = in.nextInt();
        if (getPrimeNum(ss)==true&&((getPrimeNum(Integer.valueOf(ss)+6)==true)||(getPrimeNum(Integer.valueOf(ss)-6)==true))&&ss>1){
            System.out.println("Yes");
            if (getPrimeNum(Integer.valueOf(ss)-6)==true&&((Integer.valueOf(ss)-6)>0)){
                System.out.print(Integer.valueOf(ss)-6);
            }else {
                System.out.print(Integer.valueOf(ss)+6);
            }
        }else {
            System.out.println("No");
            while (!(getPrimeNum(ss)==true&&((getPrimeNum(Integer.valueOf(ss)+6)==true)||(getPrimeNum(Integer.valueOf(ss)-6)==true))&&ss>1)){
                ss++;
            }
            System.out.print(ss);
        }
    }


    // 是质数就返回true，不是就是false
    public static boolean  getPrimeNum(Integer integer){
        boolean flag = true;
        if (integer==0||integer==1||integer<0){
            return false;
        }
        for (int i = 2; i <= Math.sqrt(integer); i++) {
            if (integer%i==0){
                flag = false;
            }
        }

        return flag;
    }
}
